home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
win
/
pascal
/
fcsrc.exe
/
FCDLGS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-06-04
|
15KB
|
542 lines
unit FCDLGS;
{$R FCDLGS}
interface
uses WinTypes, WinProcs, WObjects, WinDOS, Strings;
{$I fc.inc}
const
id_DirDlg = 400;
id_DirListbox = 401;
id_DirPrompt = 402;
id_ExeDlg = 410;
id_ExePrompt = 411;
id_ExeFilebox = 412;
id_ExeDirbox = 413;
id_ExeFilePrompt = 414;
id_SaveAsDlg = 420;
id_Namebox = 421;
id_SctnDlg = 430;
id_SctnList = 431;
id_SetupDlg = 440;
id_ItmEdit = 441;
id_GrpCombo = 442;
id_InstallBtn = 443;
type
PDirDlg = ^TDirDlg;
TDirDlg = object(TDialog)
Buffer: PChar;
constructor Init(AParent: PWindowsObject; ABuffer: PChar);
procedure SetupWindow; virtual;
procedure MsgDirListbox(var Msg: TMessage);
virtual id_First + id_DirListbox;
procedure Ok(var Msg: TMessage); virtual id_First + id_Ok;
end;
PExeDlg = ^TExeDlg;
TExeDlg = object(TDialog)
Buffer: PChar;
FileBox: PListBox;
constructor Init(AParent: PWindowsObject; ABuffer: PChar);
procedure SetupWindow; virtual;
procedure MsgExeFilebox(var Msg: TMessage);
virtual id_First + id_ExeFilebox;
procedure MsgExeDirbox(var Msg: TMessage);
virtual id_First + id_ExeDirbox;
procedure Ok(var Msg: TMessage);
virtual id_First + id_Ok;
end;
PSaveAsDlg = ^TSaveAsDlg;
TSaveAsDlg = object(TDialog)
Buffer: PChar;
NameBox: PEdit;
constructor Init(AParent: PWindowsObject; ABuffer: PChar);
procedure SetupWindow; virtual;
function CanClose: Boolean; virtual;
end;
type
PSctnDlg = ^TSctnDlg;
TSctnDlg = object(TDialog)
Buffer: PChar;
BufferSize: Word;
SctnList: PListbox;
OkBtn: PButton;
constructor Init(AParent: PWindowsObject; ABuffer: PChar;
ABufferSize: Word);
function CanClose: Boolean; virtual;
procedure SetupWindow; virtual;
procedure CMSctnList(var Msg: TMessage);
virtual id_First + id_SctnList;
end;
PPmGroup = ^TPmGroup;
TPmGroup = object(TObject)
Filename: Array[0..100] of Char;
Title : Array[0..100] of Char;
constructor Init;
procedure NextGroup(AFilename: PChar);
end;
PInstallDlg = ^TInstallDlg;
TInstallDlg = object(TDialog)
SectionName: PChar;
TheItm, TheGrp: PChar;
ItmEdit: PEdit;
GrpCombo: PCombobox;
ServerWindow: HWnd;
PendingMessage: Word;
constructor Init(AParent: PWindowsObject;
ASectionName, AnItm, AGrp: PChar);
procedure SetupWindow; virtual;
procedure CMInstall(var Msg: TMessage);
virtual id_First + id_InstallBtn;
procedure WMDDEAck(var Msg: TMessage);
virtual wm_First + wm_DDE_Ack;
procedure WMDDETerminate(var Msg: TMessage);
virtual wm_First + wm_DDE_Terminate;
procedure WMDestroy(var Msg: TMessage);
virtual wm_First + wm_Destroy;
procedure InitiateDDE;
procedure TerminateDDE;
end;
implementation
{ ----- TDirDlg methods ---------------------------------------------- }
constructor TDirDlg.Init(AParent: PWindowsObject; ABuffer: PChar);
var
AControl: PControl;
begin
TDialog.Init(AParent, PChar(id_DirDlg));
Buffer := ABuffer;
AControl := New(PListBox, InitResource(@Self, id_DirListbox));
AControl := New(PStatic, InitResource(@Self, id_DirPrompt,
fsPathName+1));
end;
procedure TDirDlg.SetupWindow;
begin
DlgDirList(HWindow, GetCurDir(Buffer, 0), id_DirListbox,
id_DirPrompt, $C010);
end;
procedure TDirDlg.MsgDirListbox(var Msg: TMessage);
begin
if Msg.LParamHi = lbn_DblClk then
begin
DlgDirSelect(HWindow, Buffer, id_DirListbox);
FileExpand(Buffer, Buffer);
DlgDirList(HWindow, Buffer, id_DirListbox, id_DirPrompt, $C010);
end;
end;
procedure TDirDlg.Ok(var Msg: TMessage);
var
Len: Integer;
begin
Buffer[0] := #0;
DlgDirSelect(HWindow, Buffer, id_DirListbox);
if StrIComp(Buffer, '') = 0 then
begin
FileExpand(Buffer, Buffer);
Len := StrLen(Buffer) - 1;
if Buffer[Len] = '\' then
Buffer[Len] := #0;
TDialog.Ok(Msg);
end
else
begin
FileExpand(Buffer, Buffer);
DlgDirList(HWindow, Buffer, id_DirListbox, id_DirPrompt, $C010);
end;
end;
{ ---- TExeDlg methods -------------------------------------------------- }
constructor TExeDlg.Init(AParent: PWindowsObject; ABuffer: PChar);
var
AControl: PControl;
begin
TDialog.Init(AParent, PChar(id_ExeDlg));
Buffer := ABuffer;
FileBox := New(PListBox, InitResource(@Self, id_ExeFilebox));
AControl := New(PListBox, InitResource(@Self, id_ExeDirbox));
AControl := New(PStatic, InitResource(@Self, id_ExePrompt,
fsPathName+1));
AControl := New(PStatic, InitResource(@Self, id_ExeFilePrompt,
fsPathName+1));
end;
procedure TExeDlg.SetupWindow;
var
FileSpec: array[0..10] of Char;
begin
DlgDirList(HWindow, GetCurDir(Buffer, 0), id_ExeDirbox, id_ExePrompt,
$C010);
DlgDirList(HWindow, '*.exe', id_ExeFilebox, id_ExeFilePrompt, $0000);
StrCopy(FileSpec, '*.com');
SendDlgItemMessage(HWindow, id_ExeFilebox, LB_DIR, $0000,
Longint(@FileSpec));
StrCopy(FileSpec, '*.bat');
SendDlgItemMessage(HWindow, id_ExeFilebox, LB_DIR, $0000,
Longint(@FileSpec));
StrCopy(FileSpec, '*.pif');
SendDlgItemMessage(HWindow, id_ExeFilebox, LB_DIR, $0000,
Longint(@FileSpec));
end;
procedure TExeDlg.MsgExeDirbox(var Msg: TMessage);
begin
if Msg.LParamHi = lbn_DblClk then
TExeDlg.Ok(Msg);
end;
procedure TExeDlg.MsgExeFilebox(var Msg: TMessage);
begin
if Msg.LParamHi = lbn_DblClk then
TExeDlg.Ok(Msg);
end;
procedure TExeDlg.Ok(var Msg: TMessage);
var
FileSpec: array[0..10] of Char;
Len: Integer;
begin
Buffer[0] := #0;
DlgDirSelect(HWindow, Buffer, id_ExeDirbox);
if StrIComp(Buffer, '') > 0 then
begin
FileExpand(Buffer, Buffer);
DlgDirList(HWindow, Buffer, id_ExeDirbox, id_ExePrompt, $C010);
DlgDirList(HWindow, '*.exe', id_ExeFilebox, id_ExeFilePrompt, $0000);
StrCopy(FileSpec, '*.com');
SendDlgItemMessage(HWindow, id_ExeFilebox, LB_DIR, $0000, Longint(@FileSpec));
StrCopy(FileSpec, '*.bat');
SendDlgItemMessage(HWindow, id_ExeFilebox, LB_DIR, $0000, Longint(@FileSpec));
StrCopy(FileSpec, '*.pif');
SendDlgItemMessage(HWindow, id_ExeFilebox, LB_DIR, $0000, Longint(@FileSpec));
end
else
begin
DlgDirSelect(HWindow, Buffer, id_ExeFilebox);
if StrIComp(Buffer, '') > 0 then
begin
FileExpand(Buffer, Buffer);
Len := StrLen(Buffer) - 1;
if Buffer[Len] = '\' then
Buffer[Len] := #0;
TDialog.Ok(Msg);
end;
end;
end;
{ ---- TSaveAsDlg methods ---------------------------------------------- }
constructor TSaveAsDlg.Init(AParent: PWindowsObject; ABuffer: PChar);
begin
TDialog.Init(AParent, PChar(id_SaveAsDlg));
Buffer := ABuffer;
NameBox := New(PEdit, InitResource(@Self, id_Namebox, PrgManItm+1));
end;
procedure TSaveAsDlg.SetupWindow;
begin
TDialog.SetupWindow;
NameBox^.Insert(Buffer);
end;
function TSaveAsDlg.CanClose: Boolean;
begin
NameBox^.GetText(Buffer, PrgManItm+1);
if StrIComp(Buffer, ' ') < 1 then
CanClose := FALSE
else
CanClose := TRUE;
end;
{ ---- TSctnDlg methods ------------------------------------------------ }
constructor TSctnDlg.Init(AParent: PWindowsObject; ABuffer: PChar;
ABufferSize: Word);
begin
TDialog.Init(AParent, PChar(id_SctnDlg));
Buffer := ABuffer;
BufferSize := ABufferSize;
SctnList := New(PListbox, InitResource(@Self, id_SctnList));
OkBtn := New(PButton, InitResource(@Self, id_Ok));
end;
procedure TSctnDlg.SetupWindow;
var
AFile: Text;
FullIniName: array[0..fsPathName] of Char;
Buf, OutBuf: array[0..160] of Char;
i, Len: Integer;
SectionsFound: boolean;
begin
TDialog.SetupWindow;
GetWindowsDirectory(FullIniName, fsPathName+1);
StrLCat(FullIniName, '\', fsPathName+1);
StrLCat(FullIniName, IniName, fsPathName+1);
{$I-}
assign(AFile, FullIniName);
Reset(AFile);
{$I+}
if IOResult <> 0 then
begin
StrLCopy(Buf, 'File Clerk could not find ', 160);
StrLCat(Buf, StrUpper(IniName), 160);
StrLCat(Buf, '. It made a new copy in the Windows directory.', 160);
Me